﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace WpfApplication1
{
    /// <summary>
    /// Interaction logic for chooseBank.xaml
    /// </summary>
    public partial class chooseBank : Page
    {
    public static string bankName;
    public int ID = MainWindow.user.ID;
    public static List<BankAccount> bankAccounts;
        public chooseBank()
    {
      
            InitializeComponent();
            BankAccountDB account = new BankAccountDB();
           // List<string> bankAccounts = account.SelectBanks(Login.id);
             bankAccounts = account.SelectBanks(Login.id); // accounts el user bl ID 
            foreach (BankAccount acc in bankAccounts)
            {
                if (acc.BankName.Contains("QNB"))
                {
                    QNB.IsEnabled = true;
                    QNB.Content = FindResource("qnbImg"); 
                }
                else if (acc.BankName.Contains("HSBC"))
                {
                    HSBC.IsEnabled = true;
                    HSBC.Content = FindResource("hsbcImg");
                }
                else if (acc.BankName.Contains("Barclays"))
                {
                    Barclays.IsEnabled = true;
                    Barclays.Content = FindResource("nbeImg");
                }
            }
        }

        private void Login_Nav(object sender, RoutedEventArgs e)
        {
            Button btn = (Button)sender;
            bankName = btn.Name;

            Profile profile = new Profile();
            this.NavigationService.Navigate(profile);
        }
    }
}
